﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZDSoft.UPMS.Model.BusinessPart;
using ZDSoft.UPMS.Manager.BusinessPart;
using ZDSoft.UPMS.Service.BusinessPart;

namespace ZDSoft.UPMS.Component.BusinessPart
{
    public class RuleComponent : ComponentBase<Rule, RuleManager>, IRuleService
    {

        public int decreaseForGrade(int count, int unfinishTimes)
        {

            int fen = 0;

            if (count == 1)
            {
                fen = 40;

            }

            else if(count>1 && count<=5)
            {

                fen =unfinishTimes*20;
            }

            else if (count > 5 && count <= 10)
            {
                fen = unfinishTimes * 10;

            }
            else if (count > 10 && count <= 20)
            {

                fen = unfinishTimes * 5;
            }
            else if(count>20)
            {
                fen = unfinishTimes * 3;
            }

            return fen;



        }
        public double decreaseFordiscipline(int count, string type,int times)

        {
            double fen  = 0;
            if (count <= 16)
            {
                if (type == "迟到")
                {

                    fen = 3 * times;
                }
                else if (type == "旷课")
                {
                    fen = 10 * times;
                }
                else
                {


                }
            }
            else if (count > 16 && count <= 32)
            {

                if (type == "迟到")
                {
                    fen = 2.5 * times;

                }
                else if (type == "旷课")
                {
                    fen = 7.5 * times;
                }
                else
                {


                }

            }
            else if (count > 32 && count <= 64)
            {

                if (type == "迟到")
                {

                    fen = 1.5 * times;
                }
                else if (type == "旷课")
                {
                    fen = 5 * times;
                }
                else
                {


                }
            }
            else if (count > 64)
            {
                if (type == "迟到")
                {

                    fen = 1 * times;
                }
                else if (type == "旷课")
                {
                    fen = 4 * times;
                }
                else
                {


                }


            }

            return fen;

        }


        public double decreaseForclassperform(int count,string type)
        {
            double fen = 0;
            if (count >= 32)
            {
                fen = 2;
            }
            else
            {
                fen = 1;
            }

            return fen;
        }
        

    }
}
